define(['app'], function(app) {
	'use strict';

	// 实例化方法
	var factory = function(Http) {

		/**
		 * 一键切换数据获取方式
		 * @param {Object} result
		 */
		function get_data_getinfo(result) {
			if(HTTP_ISLOGIC) {
				result = '{"success": true,"msg": "","result": {"name": "促销","total_count": 100,"total_money": 1000,"total_attention_num": 500,"total_jion_num": 200,"region": ['+
            '{"region_id": "001","region_name": "江苏","attention_num": 100,"jion_num": 200,"count": 300,"money": 400},'+
            '{"region_id": "002","region_name": "浙江","attention_num": 500,"jion_num": 600,"count": 700,"money": 800}],"store": ['+
            '{"store_id": "001","store_name": "店铺1","attention_num": 100,"jion_num": 200,"count": 300,"money": 400},'+
            '{"store_id": "002","store_name": "店铺2","attention_num": 500,"jion_num": 600,"count": 700,"money": 800}]},"session": "7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else {
				return result;
			}
		}
				return {
					// 获取首页热门品牌列表
					getinfo : function(act_id, callback) {
						Http.post({
							method : 'marketing.statistics',
							act_id : act_id,
							act_type : 3
						}, function(result) {
							// 请求成功
							if (callback)
								callback(get_data_getinfo(result).result);
						}, function(e) {
							// 请求异常
						}, function() {
							// 请求完成，一般不做什么事情
						});
					},
					// 获取首页数据
					get_rights : function(callback) {
						// post请求
						Http.post('home', {}, function(result) {
							// 函数回调
							if (callback)
								callback(result);
						});

					}
				};
	}

	factory.$inject = [ 'Http' ];
	return app.registerService("Statistics_groupbuy", factory);
});